package com.wangsd.web.sys.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

/**
 * 权限表
 */
@Data
@Entity
@Table(name = "sys_permission")
@ApiModel(value = "权限表", description = "权限表")
public class SysPermission {

    @ApiModelProperty(value = "id")
    @Id
    /*mybatis plus 自增主键*/
    @TableId(type = IdType.AUTO)
    /*jpa 生成自增策略*/
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @ApiModelProperty(value = "（逻辑删除）是否已删；0，未删，1，已删")
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "权限主体角色id")
    private Long roleId;

    @ApiModelProperty(value = "权限访问类型 1 菜单 2 按钮 3 模块")
    private Integer accessType;

    @ApiModelProperty(value = "权限访问id menuId或者buttonId或者applicationId")
    private Long accessId;

    @ApiModelProperty(value = "权限字符串")
    private String accessSign;

    @ApiModelProperty(value = "菜单id")
    @Transient
    @TableField(exist = false)
    private Long menuId;
}
